#include "touchscreen.h"

void touchscreen_test(void)
{
	unsigned int fb_base;
	int xres,yres, bpp;
	int x, y, pressure;

	get_lcd_params(&fb_base, &xres, &yres, &bpp);
	printf("fb_base = 0x%08x , xres = %d , yres = %d , bpp = %d", fb_base, xres, yres, bpp);

	touchscreen_init();

	clear_screen(0);

	fb_print_str(70, 70, "Touch cross to calibrate touchscreen", 0xffffff);
	
	ts_calibrate();	

	fb_print_str(70, yres - 70, "OK! To draw!", 0xffffff);
	
	while(1)
	{
		if(ts_read(&x, &y, &pressure) == 0)
		{
			printf("x = %d, y = %d\n\r", x, y);
			if(pressure)
			{
				fb_put_pixel(x, y, 0xff00);
			}
		}
	}
}


